<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Users extends MY_Controller {

    function __construct() {
        parent::__construct();
        $this->load->model('users_model');
    }

    public function login() {

        $post = $this->input->post(null, true);

        if ($post['username'] == '' || $post['password'] == '') {
            redirect('welcome');
        }

        if ($this->users_model->users_login_validation($post)) {
            redirect('home');
        }else{
			redirect('welcome');
		}
    }

    public function logout() {
        if ($this->users_model->users_process_logout()) {
            redirect('welcome');
        } else {
            redirect('home');
        }
    }

}
